package channelHandler

import (
	"gitee.com/fierce_wolf/go-fox-edge-common/commEntity"
	"gitee.com/fierce_wolf/go-fox-edge-common/edgeEntity"
	scriptEngine2 "go-fox-edge-channel-tcp-server/channelEngine/scriptEngine"
)

type OperateEntityNotify struct {
	OperateEntity *edgeEntity.OperateEntity
	Format        string
}

func (e *OperateEntityNotify) Notify(updateTime int64, addMap map[string]commEntity.IEntity, delSet map[string]commEntity.IEntity, mdyMap map[string]commEntity.IEntity) {
	for _, entity := range mdyMap {
		operateEntity := entity.(*edgeEntity.OperateEntity)

		if !scriptEngine2.HasScriptEngine(operateEntity.Manufacturer, operateEntity.DeviceType, operateEntity.OperateMode) {
			continue
		}

		scriptEngine2.ReloadScriptEngine(operateEntity.Manufacturer, operateEntity.DeviceType, operateEntity)
	}
}
